#include<iostream>
using namespace std;
#include<vector>
class Solution {
public:
    int maximumSumSubsequence(vector<int>& nums, vector<vector<int>>& queries) {
        int n = nums.size();
        long long ans = 0;
        vector<long long> dp(n + 1, 0);
        for (int i = 0; i < queries.size(); ++i) {
            nums[queries[i][0]] = queries[i][1];
            dp[1] = nums[0] > 0 ? nums[0] : 0;
            for (int j = 2; j <= n; ++j) {
                dp[j] = max(dp[j - 1], dp[j - 2] + nums[j - 1]);
            }
            ans += dp.back();
            ans %= (1000000000 + 7);
        }
        return ans;
    }
};
int main() {
    vector<int> nums{ 0,3,3,3,1,-2};
    vector<vector<int>> que{ {4,0},{1,0} };
    Solution().maximumSumSubsequence(nums, que);
}